<?php
/**
 * Created by : Sandi Rizky Kharisma (sandi.informatics08@gmail.com)
 * This Class Generated for CRUD purpose only
 */
class m_realisasi_angsuran extends CI_Model
{

    function __construct()
    {
        parent::__construct();
    }

    public function get($where = null, $limit = null, $offset = null)
    {
        if($where != null) $this->db->where($where);
        if($limit != null && $offset != null) $this->db->limit($limit, $offset);
        return $this->db->get("realisasi_angsuran");
    }

    function get_all($limit, $uri)
    {
        $result = $this->db->get('realisasi_angsuran', $limit, $uri);
        if ($result->num_rows() > 0)
        {
            return $result->result_array();
        } else
        {
            return array();
        }
    }

    function get_one($id)
    {
        $this->db->where('ID_ANGSURAN', $id);
        return $this->db->get('realisasi_angsuran');
    }

    function insert()
    {
         $data = array(
                'ID_ANGSURAN' => $this->input->post('ID_ANGSURAN', TRUE),
                'ID_PINJAMAN' => $this->input->post('ID_PINJAMAN', TRUE),
                'TGL_ANGSURAN' => $this->input->post('TGL_ANGSURAN', TRUE),
                'ANGSURAN_KE' => $this->input->post('ANGSURAN_KE', TRUE),
                'STATUS' => $this->input->post('STATUS', TRUE),
                'CICILAN_POKOK' => $this->input->post('CICILAN_POKOK', TRUE),
                'BUNGA' => $this->input->post('BUNGA', TRUE),
                'ANGSURAN' => $this->input->post('ANGSURAN', TRUE),
                'PIUTANG' => $this->input->post('PIUTANG', TRUE)

        );
        return $this->db->insert('realisasi_angsuran', $data);
    }

    function update($id)
    {
         $data = array(

                'ID_ANGSURAN' => $this->input->post('ID_ANGSURAN', TRUE),
                'ID_PINJAMAN' => $this->input->post('ID_PINJAMAN', TRUE),
                'TGL_ANGSURAN' => $this->input->post('TGL_ANGSURAN', TRUE),
                'ANGSURAN_KE' => $this->input->post('ANGSURAN_KE', TRUE),
                'STATUS' => $this->input->post('STATUS', TRUE),
                'CICILAN_POKOK' => $this->input->post('CICILAN_POKOK', TRUE),
                'BUNGA' => $this->input->post('BUNGA', TRUE),
                'ANGSURAN' => $this->input->post('ANGSURAN', TRUE),
                'PIUTANG' => $this->input->post('PIUTANG', TRUE)

        );
        $this->db->where('ID_ANGSURAN', $id);
        return $this->db->update('realisasi_angsuran', $data);
    }

    function delete($id)
    {
        $this->db->where('ID_ANGSURAN', $id);
        $this->db->delete('realisasi_angsuran');
    }

}
?>
